import { get_patient_sickbed_log } from "@/services/sickbeds";
import { ProColumns, ProTable } from "@ant-design/pro-components"

interface Iprops {
    patientId: number | undefined;
}
type GithubIssueItem = {
    id: number;
    time: string;
    call_type: number;
    create_time: string;
    status: number;
    status_d: string;
    total_time: number;
};
const FamilySickBeds = (props: Iprops) => {
    const { patientId } = props
    // 建床记录列表
    const getSickBedsLogs = async (params: {
        pageSize?: number | undefined;
        current?: number | undefined;
        keyword?: string | undefined;
    }) => {
        //默认分页参数和后端接口字段不匹配
        let request_body = {
            ...params,
            patient_id: patientId,
            current: params.current,
            pageSize: params.pageSize,
        };
        let res = await get_patient_sickbed_log(request_body)
        console.log('建床记录列表', res);
        return {
            data: res.data.list,
            success: true,
            total: res.data.total_count,
        };
    }
    // 建床记录
    const columns: ProColumns<GithubIssueItem>[] = [
        {
            title: '序号',
            dataIndex: 'index',
            valueType: 'index',
            hideInSearch: true,
            align: 'center',
        },
        {
            title: '病床编号',
            dataIndex: 'sickbed_code',
            align: 'center',
        },
        {
            title: '建床时间',
            dataIndex: 'create_time',
            align: 'center',
        },
    ];
    return <div>
        <ProTable<GithubIssueItem>
            columns={columns}
            cardBordered
            request={async (params = {}) => getSickBedsLogs(params)}
            editable={{
                type: 'multiple',
            }}
            rowKey={(record) => record.id}
            search={false}
            options={false}
            pagination={{
                pageSize: 10,
            }}
            dateFormatter="string"
            headerTitle=""
        />
    </div>
}
export default FamilySickBeds;